/*
 * PluginResult.h
 *
 *  Created on: 2011. 3. 15.
 *      Author: JeeHoon
 */
#ifndef PLUGINRESULT_H
#define PLUGINRESULT_H

#include <FBase.h>
#include "Common.h"
#include "Utility.h"

/* Plugin Status */
enum Status{
	NO_RESULT,
	OK,
	CLASS_NOT_FOUND_EXCEPTION,
	ILLEGAL_ACCESS_EXCEPTION,
	INSTANTIATION_EXCEPTION,
	MALFORMED_URL_EXCEPTION,
	IO_EXCEPTION,
	INVALID_ACTION,
	JSON_EXCEPTION,
	ERROR
};

class PluginResult
{
public:
	PluginResult();
	~PluginResult();


	result inti(Status status);
	result inti(Status status, const mchar * message);
	result inti(Status status, Osp::Base::String message);
	result inti(Status status, cJSON * jsonMessage, Osp::Base::String cast);
	result inti(Status status, int i);
	result inti(Status status, float f);
	result inti(Status status, bool b);

	Osp::Base::String toSuccessCallbackString(Osp::Base::String callbackId);
	Osp::Base::String toErrorCallbackString(Osp::Base::String callbackId);

	void setStatus(Status Status);
	void setMessage(Osp::Base::String message);
	void setKeepCallback(bool keepCallback);

	Status getStatus();
	Osp::Base::String getMessage();
	bool getKeepCallback();

	Osp::Base::String getStateText();

private:
	Osp::Base::String getJSONString();

	Osp::Base::String	__cast;
	Status 				__status;
	Osp::Base::String	__message;
	bool	__keepCallback;

	static const char * PluginResultText[];

public:
};

#endif // PLUGINRESULT_H
